<?php

class CreateDateBehavior extends CActiveRecordBehavior
{
	public $createdField = '';

	public function beforeValidate($event){
		if($this->owner->isNewRecord)
			$this->owner->{$this->createdField} = date('Y-m-d H:i:s');
    }
}